<?php

declare(strict_types=1);

namespace Modules\Takestock\Models;

use Catch\Base\CatchModel as Model;

/**
 * @property $id
 * @property $creator_id
 * @property $created_at
 * @property $updated_at
 * @property $deleted_at
 * @property $order_id
 * @property $order_detail_id
 * @property $material_no
 * @property $wms_code
 * @property $location
 * @property $lot_num
 * @property $qty
 * @property $stock_qty
 * @property $remark
 * @property $unit
*/
class InventoryOrderDetailschedule extends Model
{
    

    protected $table = 'inventory_order_detailschedule';

    protected $fillable = [ 'id', 'creator_id', 'created_at', 'updated_at', 'deleted_at', 'order_id', 'order_detail_id', 'material_no', 'wms_code', 'location', 'lot_num', 'qty', 'stock_qty', 'remark', 'unit','new_material' ];

    /**
     * @var array
     */
    protected array $fields = [ 'id', 'creator_id', 'created_at', 'updated_at', 'deleted_at', 'order_id', 'order_detail_id', 'material_no', 'wms_code', 'location', 'lot_num', 'qty', 'stock_qty', 'remark', 'unit','new_material' ];

    /**
     * @var array
     */
    protected array $form = [ 'id', 'creator_id', 'created_at', 'updated_at', 'deleted_at', 'order_id', 'order_detail_id', 'material_no', 'wms_code', 'location', 'lot_num', 'qty', 'stock_qty', 'remark', 'unit','new_material' ];

    /**
     * @var array
     */
    public array $searchable = [
        'ordernumber' => 'like',
        'state' => 'like',
    ];
    
    //输出相应的时间格式
    protected function serializeDate($date)
    {
        return $date->format('Y-m-d H:i');
    }
    
    /**
     * 链表查询
     */
    public function detailscheckOne()
    {
        return $this->hasOne(Inspectionlistcheck::class);//查一条
    }

    public function detailscheckAll()
    {
        return $this->hasMany(Inspectionlistcheck::class);//查多条
    }


    
}
